import Vue from 'vue'
import Main from './main.vue'
import {isVNode}  from '../../utils/vdom'

let UserConstructor = Vue.extend(Main);

let vnode;

const User  = function(options){
    options = options || {show:true};
    vnode = new UserConstructor({
        data: options
    })
    if (isVNode(vnode.content)) {
        vnode.$slots.default = [vnode.content];
        vnode.content = null;
    }
    vnode.$mount();
    document.body.appendChild(vnode.$el);
    return vnode 
}

export default User